package com.ndp.fb.enums.search;

/**
 * Created by Sisi on 15-3-24.
 */
public enum DemographicType {
    /**
     * life_events  生活纪事
     */
    life_events(1, "life_events"),

    /**
     * politics 政治（美国）
     */
    politics(2, "politics"),

    /**
     * markets
     */
    markets(3, "markets"),

    /**
     * industries 工作 行业
     */
    industries(4, "industries"),

    /**
     * income
     */
    income(5, "income"),

    /**
     * net_worth
     */
    net_worth(6, "net_worth"),

    /**
     * home_type
     */
    home_type(7, "home_type"),

    /**
     * home_ownership
     */
    home_ownership(8, "home_ownership"),

    /**
     * home_value
     */
    home_value(9, "home_value"),

    /**
     * ethnic_affinity 族裔
     */
    ethnic_affinity(10, "ethnic_affinity"),

    /**
     * generation 世代
     */
    generation(11, "generation"),

    /**
     * household_composition
     */
    household_composition(12, "household_composition"),

    /**
     * moms
     */
    moms(13, "moms"),

    /**
     * office_type
     */
    office_type(14, "office_type"),


    /**
     * family_statuses  父母
     */
    family_statuses(15, "family_statuses");

    /**
     * type
     */
    private int index;

    /**
     * type
     */
    private String type;


    private DemographicType(int index, String type) {
        this.index = index;
        this.type = type;
    }

    /**
     * 根据type获取Status
     *
     * @param type type
     * @return Status
     */
    public static DemographicType getDemographicType(String type) {
        for (DemographicType c : DemographicType.values()) {
            if (c.type.equals(type)) {
                return c;
            }
        }

        return null;
    }

    /**
     * 根据type获取Status
     *
     * @param index index
     * @return Status
     */
    public static DemographicType getDemographicType(int index) {
        for (DemographicType c : DemographicType.values()) {
            if (c.index == index) {
                return c;
            }
        }

        return null;
    }

}
